﻿#ifndef LUA_SCRIPT_H
#define LUA_SCRIPT_H

#include "lua_script_global.h"
#include <iostream>
#include <string>
#include <vector>
#include <QObject>
#include "lua.hpp"
#include <QMap>
#include <QThread>
#include <QWaitCondition>
#include <QMutex>
#include "syssignal.h"

typedef struct RobJointTarget
{
    double rax[6];
    double rex[7];
};
typedef struct RobTarget
{
    double pos[3];
    double rotation[4];
};


using namespace std;



//void nextrun();

class LUA_SCRIPT_EXPORT Lua_script:public QObject
{
    Q_OBJECT
public:
    Lua_script(QObject* parent=nullptr);
     ~Lua_script();
    void setvcc(string vc);
    string getvcc();
    void setzone(string zone);
    string getzone();
    void settool(string tool);
    string gettool();
    void setwobj(string wobj);
    string getwobj();
    void setload(string load);
    string getload();
    int getProStatus();
    void load_program(QString pro);
    void runprogram();

signals:
    void sig_stringMsg(QString str);
    void sig_movej(QVector<double> vec,QString v,QString z,QString t,QString w,QString l);
    void sig_movep(QVector<double> vec,QString v,QString z,QString t,QString w,QString l);
    void sig_movel(QVector<double> vec,QString v,QString z,QString t,QString w,QString l);
    void sig_movec(QVector<double> vec,QString v,QString z,QString t,QString w,QString l);
    void executepro();
    void load_string();
public slots:
    void nextrun();
    void slot_movej();
    void slot_moveL();
    void slot_moveP();
    void slot_moveC();
private:   
    bool _stepmode;
    QThread* prothread;
};
#endif // LUA_SCRIPT_H
